package com.hmsg.health.bean.enums;

public enum SMSStatusEnum implements CodeEnum {
    PHONE_NUMBER_ERROR(-1,"手机号码错误"),
    SUCCESS(1,"成功"),
    SENDCODE_SUCCESS(2,"短信验证码正确"),
    ERROR(0,"发送短信验证失败"),
    ERROR_TIMEOUT(-2,"没有发送过验证码或验证码已过期"),
    ERROR_EXIT(-3,"已经发送过验证码了，请稍后再试"),
    ERROR_OLDXCODE_NULL(-4,"请输入原手机号的短信验证码"),
    PHONE_EXIT(-5,"该手机号已被注册"),

    ERROR_OLDXCODE(-6,"短信验证码错误"),
    ERROR_(-7,"密码不符合格式"),
    ;

    private int code;
    private String message;
    SMSStatusEnum(int code, String message) {
        this.code=code;
        this.message=message;
    }

    public static CodeEnum getErrorCode(int code){
        SMSStatusEnum[] values = SMSStatusEnum.values();
        for (SMSStatusEnum e : values) {
            if (e.getCode() == code) {
                return e;
            }
        }
        return null;
    }
    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }
}
